# models/user.py
from sqlalchemy import Column, Integer, String, UniqueConstraint

from app.database.base import Base


class User(Base):
    __tablename__ = 'users'

    id = Column(Integer, primary_key=True)
    username = Column(String(50), nullable=False)
    email = Column(String(100), nullable=False)

    # 联合唯一约束（用户名+邮箱）
    __table_args__ = (
        UniqueConstraint('username', 'email', name='uix_username_email'),
    )